'use strict';

/**
 * Config for the router
 */
angular.module('app')
    .run(
    ['$rootScope', '$state', '$stateParams',
        function ($rootScope, $state, $stateParams) {
            $rootScope.$state = $state;
            $rootScope.$stateParams = $stateParams;
        }
    ]
)
    .config(['$stateProvider', '$urlRouterProvider',
        function ($stateProvider, $urlRouterProvider) {

            $urlRouterProvider
                .otherwise('/app/home');
            $stateProvider
                .state('app', {
                    abstract: true,
                    url: '/app',
                    templateUrl: 'tpl/app.html'
                })

                .state('app.home', {
                    url: '/home',
                    templateUrl: 'tpl/home.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'vendor/jquery/echarts-2.2.7/build/dist/echarts-all.js',
                                    'js/controllers/home/home.js',
                                    'js/services/home/home.js',
                                    'css/content-css/home.css'
                                ]);
                            }]
                    }
                })

                //goods
                .state("app.goods",{
                    url:'/goods',
                    templateUrl:'tpl/goods/goods.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load(['js/controllers/goods/goods.js','js/services/goods/goods.js']);
                            }
                        ]
                    }
                })

                .state("app.goodsAdd",{
                    url:'/goods/add',
                    templateUrl:'tpl/goods/goods_add.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function( $ocLazyLoad ){
                                return $ocLazyLoad.load('ui.select').then(
                                    function(){
                                        return $ocLazyLoad.load([
                                            'js/controllers/goods/goods_add.js',
                                            'js/services/goods/goods_add.js',
                                            'js/controllers/goods/goods_sku.js',
                                            'js/services/goods/goods_sku.js',
                                            'css/content-css/goods/goods_ae.css'
                                        ]);
                                    }
                                );
                            }
                        ]
                    }

                })
                .state("app.goodsEdit",{
                    url:'/goods/edit/:id',
                    templateUrl:'tpl/goods/goods_edit.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function( $ocLazyLoad ){
                                return $ocLazyLoad.load('ui.select').then(
                                    function(){
                                        return $ocLazyLoad.load([
                                            'js/controllers/goods/goods_edit.js',
                                            'js/services/goods/goods_edit.js',
                                            'js/controllers/goods/goods_sku.js',
                                            'js/services/goods/goods_sku.js',
                                            'css/content-css/goods/goods_ae.css'
                                        ]);
                                    }
                                );
                            }
                        ]
                    }
                })

                .state("app.goodsDetail",{
                    url:'/goods/detail/:id',
                    templateUrl:'tpl/goods/goods_detail.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'css/content-css/goods/goods_detail.css',
                                    'js/controllers/goods/goods_detail.js',
                                    'js/services/goods/goods_detail.js'
                                ]);
                            }
                        ]
                    }
                })

                .state("app.goodsDetailPictures",{
                    url:'/goods/detail/pictures/:chainGoodsId',
                    templateUrl:'tpl/goods/goods_detail_pictures.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function( $ocLazyLoad){
                                return $ocLazyLoad.load('angularFileUpload').then(
                                    function(){
                                        return $ocLazyLoad.load([
                                            'css/content-css/upload/picture_upload.css',
                                            'css/content-css/goods/goods_ae.css',
                                            'js/controllers/goods/goods_detail_pictures.js',
                                            'js/services/goods/goods_detail_pictures.js'
                                        ]);
                                    }
                                );
                            }
                        ]
                    }
                })



                //goods-type
                .state("app.goodsTypes",{
                    url:'/goods/types',
                    templateUrl:'tpl/goods/goods_types.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function( $ocLazyLoad){
                                return $ocLazyLoad.load('angularFileUpload').then(
                                    function(){
                                        return $ocLazyLoad.load([
                                            'css/content-css/upload/picture_upload.css',
                                            'css/content-css/goods/goods_types.css',
                                            'js/controllers/goods/goods_types.js',
                                            'js/services/goods/goods_types.js'
                                        ]);
                                    }
                                );
                            }
                        ]
                    }
                })

                .state("app.goodsAudit",{
                    url:'/goodsAudit',
                    templateUrl:'tpl/goods/goods_audit.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/goods/goods_audit.js',
                                    'js/controllers/goods/goods_audit.js'
                                ]);
                            }
                        ]
                    }
                })

                .state("app.goodsAuditFail",{
                    url:'/goodsAudit/audit/fail/:id',
                    templateUrl:'tpl/goods/goods_audit_fail.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([ 'js/services/goods/goods_audit.js',
                                    'js/controllers/goods/goods_audit.js']);
                            }]
                    }
                })

                .state("app.goodsAuditInfo",{
                    url:'/goodsAuditInfo/:id',
                    templateUrl:'tpl/goods/goods_detail.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'css/content-css/goods/goods_detail.css',
                                    'js/services/goods/goods_detail.js',
                                    'js/controllers/goods/goods_detail.js'
                                ]);
                            }
                        ]
                    }
                })


                //goods-evaluate
                .state("app.goodsDetailevaluate",{
                    url:'/goods/detailevaluate/:id',
                    templateUrl:'tpl/goods/goods_detail_evaluate.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/controllers/goods/goods_detail_evaluate.js',
                                    'js/services/goods/goods_detail_evaluate.js'
                                ]);
                            }]
                    }
                })

                //shop
                .state("app.shop",{
                    url:'/shop',
                    templateUrl:'tpl/shop/shop.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'css/content-css/shop/shop.css',
                                    'js/controllers/shop/shop.js',
                                    'js/services/shop/shop.js'
                                ]);
                        }]
                    }

                })

                .state("app.shopAdd",{
                    url:'/shop/add',
                    templateUrl:'tpl/shop/shop_add.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'css/content-css/shop/shop.css',
                                    'js/controllers/shop/shop.js',
                                    'js/services/shop/shop.js'
                                ]);
                            }]
                    }
                })


                .state("app.shopEdit",{
                    url:'/shop/edit/:id',
                    templateUrl:'tpl/shop/shop_edit.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'css/content-css/shop/shop.css',
                                    'js/controllers/shop/shop.js',
                                    'js/services/shop/shop.js'
                                ]);
                            }]
                    }

                })


                //brand
                .state('app.brand',{
                    url:'/brand',
                    templateUrl:'tpl/brand/brand.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/controllers/brand/brand.js',
                                    'js/services/brand/brand.js'
                                ]);
                            }
                        ]
                    }
                })
                .state("app.brandAdd",{
                    url:'/brand/add',
                    templateUrl:'tpl/brand/brand_add.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function( $ocLazyLoad){
                                return $ocLazyLoad.load('angularFileUpload').then(
                                    function(){
                                        return $ocLazyLoad.load([
                                            'css/content-css/brand/brands.css',
                                            'css/content-css/upload/picture_upload.css',
                                            'js/services/brand/brand.js',
                                            'js/controllers/brand/brand.js',
                                        ]);
                                    }
                                );
                            }
                        ]
                    }
                })
                .state("app.brandEdit",{
                    url:'/brand/edit/:id',
                    templateUrl:'tpl/brand/brand_edit.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function( $ocLazyLoad){
                                return $ocLazyLoad.load('angularFileUpload').then(
                                    function(){
                                        return $ocLazyLoad.load([
                                            'css/content-css/brand/brands.css',
                                            'css/content-css/upload/picture_upload.css',
                                            'js/services/brand/brand.js',
                                            'js/controllers/brand/brand.js',
                                        ]);
                                    }
                                );
                            }
                        ]
                    }
                })
                .state("app.brandDetail",{
                    url:'/brand/detail/:id',
                    templateUrl:'tpl/brand/brand_detail.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/controllers/brand/brand.js',
                                    'js/services/brand/brand.js'
                                ]);
                            }
                        ]
                    }
                })

                //orders
                .state('app.detail',{
                    url:'/orders/detail',
                    templateUrl:'tpl/orders/detail.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function( $ocLazyLoad ){
                                return $ocLazyLoad.load('ui.select').then(
                                    function(){
                                        return $ocLazyLoad.load([
                                            'css/content-css/orders/detail.css',
                                            'js/services/orders/orders.js',
                                            'js/controllers/orders/orders.js']);
                                    }
                                );
                            }]
                    }
                })

                .state('app.all',{
                    url:'/orders/all',
                    templateUrl:'tpl/orders/booking_all.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })
                .state('app.ordersGoodsView',{
                    url:'/orders/goods/view/:id',
                    templateUrl:'tpl/orders/orders_detail.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'css/content-css/orders/orders_detail.css',
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })

                .state('app.ordersPriceChange',{
                    url:'/orders/price/change/:id',
                    templateUrl:'tpl/orders/orders_price_change.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })


                .state('app.cancel',{
                    url:'/orders/cancel',
                    templateUrl:'tpl/orders/cancel.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })
                .state('app.confirm',{
                    url:'/orders/confirm',
                    templateUrl:'tpl/orders/confirm.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })
                .state('app.complete',{
                    url:'/orders/complete',
                    templateUrl:'tpl/orders/complete.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })
                .state('app.wait',{
                    url:'/orders/wait',
                    templateUrl:'tpl/orders/wait.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })
                .state('app.paid',{
                    url:'/orders/paid',
                    templateUrl:'tpl/orders/paid.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function( $ocLazyLoad ){
                                return $ocLazyLoad.load('ui.select').then(
                                    function(){
                                        return $ocLazyLoad.load([
                                            'js/services/orders/orders.js',
                                            'js/controllers/orders/orders.js']);
                                    }
                                );
                            }]
                    }

                })
                .state('app.shipped',{
                    url:'/orders/shipped',
                    templateUrl:'tpl/orders/shipped.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })
                .state('app.waitUse',{
                    url:'/orders/wait/use',
                    templateUrl:'tpl/orders/wait_use.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })
                .state('app.hasUse',{
                    url:'/orders/has/use',
                    templateUrl:'tpl/orders/has_use.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })
                .state('app.fail',{
                    url:'/orders/fail',
                    templateUrl:'tpl/orders/fail.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })
                .state('app.failin',{
                    url:'/orders/failin',
                    templateUrl:'tpl/orders/failin.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })
                .state('app.deliveryUpdate',{
                    url:'/orders/deliveryUpdate/:id',
                    templateUrl:'tpl/orders/delivery_update.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/orders.js',
                                    'js/controllers/orders/orders.js']);
                            }]
                    }
                })

                .state('app.check',{
                    url:'/orders/check/:auth',
                    templateUrl:'tpl/orders/check.html',
                    cache:true,
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/check.js',
                                    'js/controllers/orders/check.js',
                                    'css/content-css/orders/check.css'
                                ]);
                            }]
                    }
                })

                .state('app.ordersRefund', {
                    url: '/orders/orders/refund',
                    templateUrl: 'tpl/orders/orders_refund.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/refund.js',
                                    'js/controllers/orders/refund.js']);
                            }]
                    }
                })
                .state('app.goodsRefund', {
                    url: '/orders/goods/refund',
                    templateUrl: 'tpl/orders/goods_refund.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/refund.js',
                                    'js/controllers/orders/refund.js']);
                            }]
                    }
                })

                .state('app.goodsRefundFail', {
                    url: '/orders/goods/refund/:id',
                    templateUrl: 'tpl/orders/shop_refund_goods_fail.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/refund.js',
                                    'js/controllers/orders/refund.js']);
                            }]
                    }
                })

                .state('app.ordersRefundFail', {
                    url: '/orders/orders/refund/:id',
                    templateUrl: 'tpl/orders/shop_refund_money_fail.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/orders/refund.js',
                                    'js/controllers/orders/refund.js']);
                            }]
                    }
                })

                .state('app.user',{
                    url:'/user/all',
                    templateUrl:'tpl/user/user.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([ 'js/services/user/user.js',
                                    'js/controllers/user/user.js']);
                            }]
                    }
                })

                .state('app.userCoupons',{
                    url:'/user/coupons/:userId',
                    templateUrl:'tpl/user/user_coupons_give.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load(['js/controllers/user/user_coupons_give.js',
                                    'js/services/user/user_coupons_give.js']);
                            }]
                    }
                })

                //mobilePhoneWhite
                .state('app.mobilePhoneWhite',{
                    url:'/mobile/phone/white',
                    templateUrl:'tpl/systemSetting/mobile_phone_white_view.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/mobile_phone_white/mobile_phone_white.js',
                                    'js/controllers/mobile_phone_white/mobile_phone_white.js'
                                ]);
                            }
                        ]
                    }
                })

                //accountSetting
                .state('app.accountSetting',{
                    url:'/security/account_setting',
                    templateUrl:'tpl/security/now_account_internal_edit.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/util/public_key.js',
                                    'js/util/jsencrypt.min.js',
                                    'js/controllers/home/account_setting.js',
                                    'js/services/home/account_setting.js'
                                ]);
                            }
                        ]
                    }
                })
                .state('app.goodsList',{
                    url:'/shop/goods_list/:shopId',
                    templateUrl:'tpl/shop/goods_list.html',
                    resolve:{
                        deps:['uiLoad',
                            function(uiLoad){
                                return uiLoad.load([
                                    'js/controllers/shop/goods_list.js',
                                    'js/services/shop/goods_list.js'
                                ])
                            }
                        ]
                    }
                })
                .state("app.shopGoodsDetail",{
                    url:'/shop/goods/detail/:id',
                    templateUrl:'tpl/shop/shop_goods_detail.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'css/content-css/goods/goods_detail.css',
                                    'js/controllers/shop/shop_goods_detail.js',
                                    'js/services/shop/shop_goods_detail.js'
                                ]);
                            }]
                    }
                })
                .state('app.chain',{
                    url:'/chain',
                    templateUrl:'tpl/chain/chain.html',
                    resolve:{
                        deps:['uiLoad',
                            function(uiLoad){
                                return uiLoad.load([
                                    'css/content-css/chain/chain.css',
                                    'js/controllers/chain/chain.js',
                                    'js/services/chain/chain.js'
                                ])
                            }
                        ]
                    }
                })
                .state('app.chainDatum',{
                    url:'/chain/datum',
                    templateUrl:'tpl/chain/chain_datum.html',
                    resolve:{
                        deps:['$ocLazyLoad',
                            function($ocLazyLoad){
                                return $ocLazyLoad.load([
                                    'css/content-css/chain/chain_datum.css'
                                ])
                            }
                        ]
                    }
                })
                .state('app.chainEdit',{
                    url:'/chain/edit',
                    templateUrl:'tpl/chain/chain_edit.html',
                    resolve:{
                        deps:['$ocLazyLoad',
                            function($ocLazyLoad){
                                return $ocLazyLoad.load([
                                    'css/content-css/upload/picture_upload.css',
                                    'css/content-css/chain/chain_edit.css',
                                    'js/controllers/chain/chain_edit.js',
                                    'js/services/chain/chain_edit.js'
                                ])
                            }
                        ]
                    }
                })
                .state('app.chainBusinessEdit',{
                    url:'/chain/business/edit',
                    templateUrl:'tpl/chain/chain_business_edit.html',
                    resolve:{
                        deps:['$ocLazyLoad',
                            function($ocLazyLoad){
                                return $ocLazyLoad.load([
                                    'css/content-css/chain/chain_edit.css',
                                    'css/content-css/upload/picture_upload.css',
                                    'js/controllers/chain/chain_business_edit.js',
                                    'js/services/chain/chain_business_edit.js'
                                ])
                            }
                        ]
                    }
                })
                .state('app.chainWechatConfig',{
                    url:'/chain/wechat/config',
                    templateUrl:'tpl/chain/chain_wechat_config.html',
                    resolve:{
                        deps:['$ocLazyLoad',
                            function($ocLazyLoad){
                                return $ocLazyLoad.load([
                                    'js/controllers/chain/chain_wechat_config.js',
                                    'js/services/chain/chain_wechat_config.js'
                                ])
                            }
                        ]
                    }
                })
                .state('app.chainBindUser',{
                    url:'/chain/bind/user',
                    templateUrl:'tpl/chain/chain_bind_user.html',
                    resolve:{
                        deps:['$ocLazyLoad',
                            function($ocLazyLoad){
                                return $ocLazyLoad.load([
                                    'js/controllers/chain/chain_bind_user.js',
                                    'js/services/chain/chain_bind_user.js'
                                ])
                            }
                        ]
                    }
                })
                //交易分析
                .state('app.transactionAnalysis', {
                    url: '/transaction/analysis',
                    templateUrl: 'tpl/data/transaction_analysis.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'vendor/jquery/echarts-2.2.7/build/dist/echarts-all.js',
                                    'js/controllers/data/transactionChart.js',
                                    'js/services/data/transactionChart.js'
                                ]);
                            }
                        ]
                    }
                })
                //商品分析
                .state('app.goodsAnalysis', {
                    url: '/goods/analysis',
                    templateUrl: 'tpl/data/goods_analysis.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/controllers/data/goodsChart.js',
                                    'js/services/data/goodsChart.js'
                                ]);
                            }
                        ]
                    }
                })
                //店铺分析
                .state('app.chainShopAnalysis', {
                    url: '/shop/analysis',
                    templateUrl: 'tpl/data/shop_analysis.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'vendor/jquery/echarts-2.2.7/build/dist/echarts-all.js',
                                    'js/controllers/data/shopChart.js',
                                    'js/services/data/shopChart.js'

                                ]);
                            }
                        ]
                    }
                })


                //会员管理
                .state('app.client', {
                    url: '/client',
                    templateUrl: 'tpl/member/client.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/controllers/member/client.js',
                                    'js/services/member/client.js'
                                ]);
                            }]
                    }
                })

                .state('app.clientAdd', {
                    url: '/client/add',
                    templateUrl: 'tpl/member/client_add.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/controllers/member/client.js',
                                    'js/services/member/client.js'
                                ]);
                            }]
                    }
                })

                .state('app.clientUpdate', {
                    url: '/client/update/:id',
                    templateUrl: 'tpl/member/client_update.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/controllers/member/client.js',
                                    'js/services/member/client.js'
                                ]);
                            }]
                    }
                })
                .state('app.memberCharge', {
                    url: '/member/charge',
                    templateUrl: 'tpl/member/member_charge.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/controllers/member/member_card_charge.js',
                                    'js/services/member/member_card_charge.js',
                                    'js/controllers/member/balance_history.js',
                                    'js/services/member/balance_history.js'
                                ]);
                            }]
                    }
                })
                .state('app.memberChargeAdd', {
                    url: '/member/charge/add',
                    templateUrl: 'tpl/member/member_charge_add.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/controllers/member/member_card_charge.js',
                                    'js/services/member/member_card_charge.js'
                                ]);
                            }]
                    }
                })
                .state('app.memberChargeUpdate', {
                    url: '/member/charge/update/:id',
                    templateUrl: 'tpl/member/member_charge_update.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/controllers/member/member_card_charge.js',
                                    'js/services/member/member_card_charge.js'
                                ]);
                            }]
                    }
                })
                .state('app.memberCard', {
                    url: '/member/card',
                    templateUrl: 'tpl/member/member_card.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'css/content-css/member/member_card.css',
                                    'js/controllers/member/member_card.js',
                                    'js/services/member/member_card.js'
                                ]);
                            }]
                    }
                })
                .state('app.memberCardAdd', {
                    url: '/member/card/add/:type',
                    templateUrl: 'tpl/member/member_card_add.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/controllers/member/member_card_add.js',
                                    'js/services/member/member_card_add.js'
                                ]);
                            }]
                    }
                })
                .state('app.memberCardUpdate', {
                    url: '/member/card/update/:id',
                    templateUrl: 'tpl/member/member_card_update.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load([
                                    'js/controllers/member/member_card_update.js',
                                    'js/services/member/member_card_update.js'
                                ]);
                            }]
                    }
                })
                .state('app.memberTransaction',{
                    url:"/member/transaction",
                    templateUrl:'tpl/member/member_transaction.html',
                    resolve:{
                        deps:['uiLoad',
                            function(uiLoad){
                                return uiLoad.load([
                                    'js/controllers/member/member_transaction.js',
                                    'js/services/member/member_transaction.js'
                                ])
                            }
                        ]
                    }
                })

                //account
                .state('app.account', {
                    url: '/security/account',
                    templateUrl: 'tpl/security/table.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/security/account.js',
                                    'js/controllers/security/account.js']);
                            }]
                    }
                })
                .state('app.accountCreate', {
                    url: '/security/account/create',
                    templateUrl: 'tpl/security/account_add.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/security/account.js',
                                    'js/controllers/security/account.js']);
                            }]
                    }
                })
                .state('app.accountEdit', {
                    url: '/security/account/edit/:systemUserId',
                    templateUrl: 'tpl/security/account_edit.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/security/account.js',
                                    'js/controllers/security/account.js']);
                            }]
                    }
                })
                //role
                .state('app.role', {
                    url: '/role',
                    templateUrl: 'tpl/security/role.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/security/role.js',
                                    'js/controllers/security/role.js']);
                            }]
                    }
                })

                .state('app.roleCreate', {
                    url: '/security/role/create',
                    templateUrl: 'tpl/security/role_add.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/security/role.js',
                                    'js/controllers/security/role.js']);
                            }]
                    }
                })
                .state('app.roleEdit', {
                    url: '/security/role/edit/:id',
                    templateUrl: 'tpl/security/role_edit.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'js/services/security/role.js',
                                    'js/controllers/security/role.js']);
                            }]
                    }
                })


                .state('app.authorize', {
                    url: '/security/authorize/:id',
                    templateUrl: 'tpl/security/authorize.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load('angularBootstrapNavTree').then(
                                    function () {
                                        return $ocLazyLoad.load([
                                            'css/content-css/tree/tree.css',
                                            'js/services/security/authorize.js',
                                            'js/controllers/security/authorize.js'
                                        ]);
                                    }
                                );
                            }]
                    }
                })

                //coupons
                .state('app.coupons', {
                    url: '/coupons',
                    templateUrl: 'tpl/coupons/coupons.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load(['js/controllers/coupons/coupons.js', 'js/services/coupons/coupons.js']);
                            }]
                    }
                })
                .state('app.couponsDetailAdd', {
                    url: '/coupons/detail/add',
                    templateUrl: 'tpl/coupons/coupons_detail_add.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load(['js/controllers/coupons/coupons_detail_add.js', 'js/services/coupons/coupons_detail_add.js']);
                            }]
                    }
                })
                .state('app.couponsDetailEdit', {
                    url: '/coupons/detail/edit/:id',
                    templateUrl: 'tpl/coupons/coupons_detail_edit.html',
                    resolve: {
                        deps: ['uiLoad',
                            function (uiLoad) {
                                return uiLoad.load(['js/controllers/coupons/coupons_detail_edit.js', 'js/services/coupons/coupons_detail_edit.js']);
                            }]
                    }
                })
                .state('app.expenseCalendar', {
                    url: '/expense/calendar',
                    templateUrl: 'tpl/data/expense_calendar.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function ($ocLazyLoad) {
                                return $ocLazyLoad.load([
                                    'vendor/jquery/echarts-2.2.7/build/dist/echarts-all.js',
                                    'js/controllers/data/expense_calendar.js',
                                    'js/services/data/expense_calendar.js'
                                ]);
                            }
                        ]
                    }
                })
                .state('app.regionalPortrait',{
                    url:'/regional/portrait',
                    templateUrl:'tpl/data/regional_portrait.html',
                    resolve:{
                        deps:['$ocLazyLoad',function($ocLazyLoad){
                            return $ocLazyLoad.load([
                                'vendor/jquery/echarts-2.2.7/build/source/echarts.min.js',
                                'js/controllers/data/regional_portrait.js',
                                'js/services/data/regional_portrait.js'
                            ])
                        }]
                    }
                })
                .state('app.promotionPoster',{
                    url:'/promotion/poster',
                    templateUrl:'tpl/marketingManager/promotion_poster.html',
                    resolve:{
                        deps:['$ocLazyLoad',function($ocLazyLoad){
                            return $ocLazyLoad.load('angularFileUpload').then(function(){
                                return $ocLazyLoad.load([
                                    'css/content-css/marketingManager/promotion_poster.css',
                                    'js/controllers/marketingManager/promotion_poster.js',
                                    'js/services/marketingManager/promotion_poster.js'
                                ])
                            });
                        }]
                    }
                })
                .state('app.promotionPosterAdd',{
                    url:'/promotion/poster/add/:id',
                    templateUrl:'tpl/marketingManager/promotion_poster_add.html',
                    resolve:{
                        deps:['$ocLazyLoad',function($ocLazyLoad){
                            return $ocLazyLoad.load('angularFileUpload').then(function(){
                                return $ocLazyLoad.load([
                                    'css/content-css/marketingManager/promotion_poster.css',
                                    'js/controllers/marketingManager/promotion_poster_add.js',
                                    'js/services/marketingManager/promotion_poster_add.js'
                                ])
                            });
                        }]
                    }
                })
      }
    ]
);
